interface Callback{              //回调方类A的接口
    boolean Consider(int money); //思考是否付钱，就是方法c
    void PayFor(int money);      //付钱,就是方法c

}
class TaxiDriver{               //调用方类B
    public int Answer(Callback callback) { //回答多少钱，就是方法b
        System.out.println("去那的话要100块");
        if (callback.Consider(100) == true) {
            callback.PayFor(100);
        }
        return 100;
    }

   
}
class Passenger implements Callback{  //回调方类A
    @Override
    public boolean Consider(int money) {
        boolean result = true;
        if(money > 80){
            System.out.println(money+"太贵了，您看80行不行？");
            result = false;
        }
        return result;
    }
    @Override
    public void PayFor(int money) {
       System.out.println("好的，这是您的"+money);
    }

    public void TakeTaxi(TaxiDriver td) { //询问多少钱，就是方法a
        System.out.println("师傅，去天一多少钱？");
        td.Answer(this);
    }
     public void test() {

    }
}

public class Example{
    public static void main(String [] args){
   TaxiDriver td = new TaxiDriver();
       Passenger passenger = new Passenger();
       passenger.TakeTaxi(td);
 
    }
}